package com.enen.service.impl;


import com.enen.service.SendMailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class SendMailServiceImpl implements SendMailService {
    @Autowired
    private JavaMailSender javaMailSender;

    private String from = "2726618624@qq.com"; //发件人
    private String to = "2972473290@qq.com"; //接收人
    private String subject = "测试文件2"; //邮件主题
    private String text = "测试邮件正文2"; //邮件内容

    @Override
    public void sendMail() {
        SimpleMailMessage MailMessage = new SimpleMailMessage();
        MailMessage.setFrom(from+"(智慧养老)");
        MailMessage.setTo(to);
        MailMessage.setSubject(subject);
        MailMessage.setText(text);
        javaMailSender.send(MailMessage);

    }
}
